/*
 * Copyright � 2008 Nokia Corporation.
 */


#ifndef SUDOKUBTNCONTROL_H
#define SUDOKUBTNCONTROL_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include <coecntrl.h>

// CLASS DECLARATION
class CSudokuContainerControl;
class CFbsBitGc;

class CSudokuBtnControl : public CCoeControl
    {
    public:
        ~CSudokuBtnControl ( );
        static CSudokuBtnControl* NewL (CSudokuContainerControl& aParent, const TRect& aRect,CFbsBitGc*& aBgc);
        static CSudokuBtnControl* NewLC (CSudokuContainerControl& aParent, const TRect& aRect,CFbsBitGc*& aBgc);
        void MakeVisible(TBool aVisible);
        
    private:
        CSudokuBtnControl (CSudokuContainerControl& aParent, CFbsBitGc*& aBgc);
        void ConstructL (const TRect& aRect);

    private:
        void Draw( const TRect& aRect ) const;
        void DrawBtns() const;
        void SizeChanged();
        void HandlePointerEventL(const TPointerEvent& aPointerEvent);
        
    private:
        TInt Number(TPoint aPoint);
        
    public:
        TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
        void HitActiveNumber();
        
    private:
        CFbsBitGc*&                 iBgc;
        CSudokuContainerControl&    iParent;
        TSize                       iBtnSize;
        
        TRect                       iBtn1Rect;
        TRect                       iBtn2Rect;
        TRect                       iBtn3Rect;
        TRect                       iBtn4Rect;
        TRect                       iBtn5Rect;
        TRect                       iBtn6Rect;
        TRect                       iBtn7Rect;
        TRect                       iBtn8Rect;
        TRect                       iBtn9Rect;
        TRect                       iBtnCRect;
        TPoint                      iDragPoint;
        
    };

#endif // SUDOKUBTNCONTROL_H
